<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="decorator" content="default" />
<title>台账统计</title>
<script type="text/javascript">
$(document).ready(function() {
	var projectid = '${tz.subProject.project.id}';
	if(projectid) {
		$('#projectId').val(projectid).trigger('change');
	}
	$("#btnExport").click(function(){
		top.$.jBox.confirm("确认要导出数据吗？","系统提示",function(v,h,f){
			if(v=="ok"){
				$("#searchForm").attr("action","${ctx}/project/tz/export");
				$("#searchForm").submit();
			}
		},{buttonsFocus:1});
		top.$('.jbox-body .jbox-icon').css('top','55px');
	});
	$("#btnSubmit").click(function(){
		$("#searchForm").attr("action","${ctx}/project/tz/tj");
		$("#searchForm").submit();
	});
});
function loadSubProject(projectId) {
	if(!projectId) {
		$('#subPro').html('<option value="">请选择单位工程</option>');
		$('#subPro').select2('val','');
		return;
	}
	$.post(
		'${ctx}/project/subProject/listSubByPro',	
		{projectId: projectId},
		function(data, textStatus, jqXHR) {
			var html = '<option value="">请选择单位工程</option>';
			for(var i=0;i<data.length;i++) {
				html+= '<option value="'+data[i].id+'">'+data[i].name+'</option>';
			}
			$('#subPro').html(html);
			$('#subPro').val('${tz.subProject.id}').trigger('change');
		},'json');
	
}
</script>
</head>
<body>
	<form:form id="searchForm" modelAttribute="tz"
		action="${ctx}/project/tz/tj" method="post" class="breadcrumb form-search">
		<label>工程 ：</label>
		<select name="subProject.project.id" class="input-medium" onchange="loadSubProject(this.value)" id="projectId">
			<option value="">请选择工程</option>
			<c:forEach items="${projectList}" var="p">
				<option value="${p.id}">${p.name}</option>
			</c:forEach>
		</select>&nbsp;
		<label>单位工程 ：</label>
		<select id="subPro" name="subProject.id" class="input-medium" >
			<option value="">请选择单位工程</option>
		</select>&nbsp;
		<label>管线编号 ：</label>
		<form:input path="gxh" htmlEscape="false" maxlength="50" class="input-medium"/>
		&nbsp;
		<label>检测方法 ：</label>
		<form:select path="jcff" class="input-medium">
			<form:option value="" label="请选择检测方法"/>
			<form:options items="${fns:getDictList('dict_jcff')}" itemLabel="label" itemValue="value"/>
		</form:select>
		&nbsp;
		<br><br>
		<label>射线源(如:X/γ) ：</label>
		<form:select path="sxy" class="input-medium">
			<form:option value="" label="请选择"/>
			<form:options items="${fns:getDictList('dict_sxy')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
		</form:select>&nbsp;&nbsp;
		<label>委托日期</label>
		<input name="wtStartDate" type="text"  maxlength="20" class="input-medium Wdate" value="${tz.wtStartDate}"
			onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
		到	
		<input name="wtEndDate" type="text"  maxlength="20" class="input-medium Wdate" value="${tz.wtEndDate}"
			onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
		&nbsp;&nbsp;	
		<label>检测日期</label>
		<input name="jcStartDate" type="text"  maxlength="20" class="input-medium Wdate" value="${tz.jcStartDate}"
			onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
		到	
		<input name="jcEndDate" type="text"  maxlength="20" class="input-medium Wdate" value="${tz.jcEndDate}"
			onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
		&nbsp;&nbsp;	
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>	
		<input id="btnExport" class="btn btn-primary" type="button" value="导出"/>
	</form:form>
	<common:message content="${message}" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>施工单位</th>
				<th>单位工程</th>
				<th>检测方法</th>
				<th>射线源</th>
				<th>检验焊口数量</th>
				<th>一次不合格焊口数量</th>
				<th>一次焊口合格率</th>
				<th>一次拍片数量</th>
				<th>一次不合格片数</th>
				<th>不合格片数量</th>
				<th>一次拍片合格率</th>
				<th>扩探口数量</th>
				<th>扩探合格数量</th>
				<th>检测长度（m）</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${data}" var="t" varStatus="i">
				<tr>
				<td>${i.index+1}</td>
				<td>${t.sgdw}</td>
				<td>${t.dwgc}</td>
				<td>${t.jcff}</td>
				<td>${t.sxy}</td>
				<td>${t.hks}</td>
				<td>${t.bhghks}</td>
				<td>${t.ychkhgl}</td>
				<td>${t.ycppsl}</td>
				<td>${t.ycbhgps}</td>
				<td>${t.bhgpsl}</td>
				<td>${t.ycpphgl}</td>
				<td>${t.ktksl}</td>
				<td>${t.kthgsl}</td>
				<td>${t.jccd}</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>